package service;

import java.util.List;

import bean.PageBean;
import bean.User;
import dao.UserDao;
import dao.UserDaoImpl;

public class UserServiceImpl implements UserService {

	@Override
	public PageBean findAllUserWithPage(int pageNum, int pageSize) {

		UserDao ud = new UserDaoImpl();
		List<User> allUser = ud.findAllUser();
		int totalRecord = allUser.size();
		PageBean pb = new PageBean(pageNum, pageSize, totalRecord);
		int startIndex = pb.getStartIndex();
		List<User> userList = ud.findAllByPage(startIndex, pageSize);
		pb.setList(userList);
		return pb;
	}

}
